package com.example.sprintboot.mapper;

import com.example.sprintboot.entity.Category;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CategoryMapper {
    @Select("select * from category")
    List<Category> selectAll();

    @Select("select * from `category` where id = #{id}")
    Category selectById(Integer id);

    @Insert("insert into `category` (name) values (#{name})")
    void add(Category category);

    @Update("update `category` set  name=#{name} where id=#{id}")
    void update(Category category);

    @Delete("delete from `category` where id = #{id}")
    void delete(Integer id);

    List<Category> query(@Param("name") String name);
}
